package bosVM2.FaultHandling;

import bosVM2.Engine.ExecutionEngine;
import bosVM2.meta.Objects.BosMethod;

public class HamDistanceFaultHandler {
	//lazy implementation, handle all arit, if, and opcode fault by replacing the ins array.
	//Specialize later, if feasable or time permits.
	//Is rather naive atm, and rather simple, enforce later?
	public void handleOpcodeFault(int pc,BosMethod m,ExecutionEngine e) {
		
		m.setInstructionAt(pc,e.getMeta().getMethodInsAtPc(m.getSuper().getClassName(), m.getName(), pc));
	}
	 
	public void handleAritcodeFault(int pc,BosMethod m,ExecutionEngine e) {
		m.setInstructionAt(pc,e.getMeta().getMethodInsAtPc(m.getSuper().getClassName(), m.getName(), pc));
	}
	
	public void handleIfcodeFault(int pc,BosMethod m,ExecutionEngine e) {
		m.setInstructionAt(pc,e.getMeta().getMethodInsAtPc(m.getSuper().getClassName(), m.getName(), pc));
	}

}
